package year2019.month08910;

public class ExtendsTest {
    public static void main(String[] args){
        Aclass aclass = new Aclass();
        Bclass bclass = new Bclass();
        Cclass cclass = new Cclass();
        Dclass dclass = new Dclass();

        aclass = bclass;
        aclass = cclass;
        aclass = dclass;

        System.out.println("==============");
        System.out.println(bclass instanceof Cclass);
//        cclass = (Cclass) bclass;

        System.out.println("==============");
        Aclass a = bclass;
        System.out.println(a instanceof Bclass);

        aclass = bclass;
        bclass = (Bclass) aclass;

//        bclass = dclass;

    }

}

class Aclass{
    String str = "a";
}

class Bclass extends Aclass{
    String str = "b";
}

class Cclass extends Bclass{
    String str = "c";
}

class Dclass extends Aclass{
    String str = "d";
}
